<?php  
	session_start();
	include_once '../pushing.php';
	
	if ($pushTime == true) {
		if ($_SESSION['UserId'] != 3)
			header('Location: push.php');
	}
	
	if(!isset($_SESSION['UserId']))
	{
		header('Location: login.php');
   		die();
	}
	
	include_once ('../Functions/SecureFunctions.php'); // contains function clearSessionSaveAdmin
	
	clearSessionSaveAdmin(); //clears all session variables except user login status
    
    require_once '../mysqlConnect.php'; //mysqli database connect	
	
	$adminID = $_SESSION['UserId'];
	
	//get administrator information
	$conn = GetConnection();
	$sql = "SELECT Title, LName FROM Administrator WHERE ID = '$adminID'";
	$result = $conn->query($sql);
	$adminInfo = $result->fetch_assoc();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
<link rel="stylesheet" type="text/css" href="../Styler.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">

var hoveredOverMenu = false;

	$(document).ready(function() {
		$("#addtoDatabase").hide();
				
		//http://stackoverflow.com/questions/1273566/how-do-i-check-if-the-mouse-is-over-an-element-in-jquery
		$("#addStuff").mouseenter(function(){
		    clearTimeout($(this).data('timeoutId'));
		    $('#addtoDatabase').slideDown('fast');
		}).mouseleave(function(){
		    var someelement = this;
		    var timeoutId = setTimeout(function(){ $('#addtoDatabase').fadeOut();}, 2000);
		    $(someelement).data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
		});

		$('#addtoDatabase').mouseenter(function(){
			//clearTimeout($(this).data('timeoutId'));
			clearTimeout($('#addStuff').data('timeoutId'));
		}).mouseleave(function(){
				var someelement = this;
			    var timeoutId = setTimeout(function(){ $('#addtoDatabase').fadeOut();}, 2000);//fadeOut
			    $(someelement).data('timeoutId', timeoutId);
		});
		
	});		
</script>
</head>
<body>
	<div id="content">
	<div id="header">
		<div id="title_box">
			<span id="title">Welcome</span>
		</div>
		</div>
	</div>
   	 
    <div id="mainMenu" >
    	<ul style="list-style: none outside none;">
	        
	        <li>
	         	<a href="choosePatient.php?SID=10">Patient ICD9</a>
	        </li>
	        
	        <li>
	         	<a href="choosePatient.php?SID=4">Patient Prescription</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=2">Physical Symptoms</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=5">Neuropsychological Symptoms</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=3">Psychological Test</a> 
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=6">Diagnostic Test</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=8">View Patient Information</a>
	        </li>
	        
	        <li>
	         	<a href="choosePatient.php?SID=7">Edit Patient Information</a>
	        </li>
	         
	        <li>
	        	<a href="choosePatient.php?SID=9">Save Patient Information</a>
	        </li>
	         
	        <li style="border-bottom: 1px solid #FD9D45;">
	       	 	<a href="query2.php">Query</a>
	        </li>
	        
	        
	        <li>
	       	 	<a href="home.php">Home</a>
	        </li> 
	         
	        <li>
	       	 	<a href="logout.php">Logout</a>
	        </li>
	        
        </ul>
     </div>
     
   
     <div class="formContainer">
	     <div class="boxStyle" style="position: relative; width: 600px; height: 300px;">
	     	<div class="boxStyleTitle">Recent Updates</div>
	     	<ul> 
	     		<li style="list-style: none">COMPLETE</li>
		     	<li>Add Medications Page</li>
		     	<li>Complete Save Patient Information Page</li>
		     	<li>Add Diagnostic Test Page</li>
	     	</ul>
	     	<ul>
	     		<li style="list-style: none">TO DO</li>
		     	<li>Complete Query Page</li>
	     	</ul>
	     </div>
     </div>
     
       
     
     <div id="addtoDatabase">
     	<div id="addtoDatabaseText">
     		<a href="Add Patient.php" style="margin-left: 40px; text-decoration: none;">Add Patient</a>
     		<a href="Add Medication.php" style="margin-left: 40px; text-decoration: none;">Add Medication</a>
     		<a href="Add Diagnostic Test.php" style="margin-left: 40px; text-decoration: none;">Add Diagnostic Test</a>
     		<a href="Add_ICD9_Entry.php" style="margin-left: 40px; margin-right: 40px; text-decoration: none;">Add ICD9 Entry</a>
     		<!-- <a href="Add Symptom.php" style="margin-left: 40px; text-decoration: none;">Add Physical Symptom</a>
     		<a href="Add Symptom.php" style="margin-left: 40px; margin-right: 40px; text-decoration: none;">Add NeuroPsychological Symptom</a> -->
     	</div>
     </div>
     
     
     <div id="footerOptions">
     	<div id="footerText">
     		Welcome <?php echo $adminInfo['Title'] . ' ' . $adminInfo['LName'];?>
     		<span id="addStuff" style="margin-left: 40px; text-decoration: none; cursor: pointer; cursor: hand;">Add To Database</span>
     		<a href="changePass.php" style="margin-left: 20px; text-decoration: none;">Change Password</a>
     		<!-- <a href="http://www.newpaltz.edu/" style="margin-left:20px; text-decoration: none;">Add Administrator</a> -->
     		<a href="mailto:ianralls19@gmail.com" style="margin-left: 20px; text-decoration: none;">Email Web Admin</a>
     		<a href="http://www.newpaltz.edu/" style="margin-left: 180px; text-decoration: none;">NewPaltz.edu</a>
     		
     	</div>
     </div>
     </div>
</body>
</html>